package 网络通信2;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class TheadServe extends Thread{
	private Socket socket;
	public TheadServe(Socket socket) {
		this.socket = socket;
	}
	public void run()
	{
		try {
			InputStream is=socket.getInputStream();
			DataInputStream dis=new DataInputStream(is);
			while(true) {
				try {
			String s=dis.readUTF();
			System.out.println(s);
			}
			catch (Exception e) {
			dis.close();
			socket.close();
			}
		}
		}
		catch(Exception e) {}
	}
}